﻿<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPages/admin.master" AutoEventWireup="true"  CodeFile="CourseEdit.aspx.cs" Inherits="CourseEdit" Title="Course Edit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">Course - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
		<data:MultiFormView ID="FormView1" DataKeyNames="CourseId" runat="server" DataSourceID="CourseDataSource">
		
			<EditItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/CourseFields.ascx" />
			</EditItemTemplatePaths>
		
			<InsertItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/CourseFields.ascx" />
			</InsertItemTemplatePaths>
		
			<EmptyDataTemplate>
				<b>Course not found!</b>
			</EmptyDataTemplate>
			
			<FooterTemplate>
				<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
				<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
				<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
			</FooterTemplate>

		</data:MultiFormView>
		
		<data:CourseDataSource ID="CourseDataSource" runat="server"
			SelectMethod="GetByCourseId"
		>
			<Parameters>
				<asp:QueryStringParameter Name="CourseId" QueryStringField="CourseId" Type="String" />

			</Parameters>
		</data:CourseDataSource>
		
		<br />

		<asp:Panel ID="CourseOfferingPanel2" runat="server" CssClass="collapsePanelHeader"> 
			<div style="padding:5px; cursor: pointer; vertical-align: middle;">
				<div style="float: left; vertical-align: middle;"><asp:Image ID="CourseOfferingImage" runat="server" ImageUrl="~/images/expand_blue.jpg"/></div>
				<div style="float: left; padding-left: 5px;">Course Offering Details</div>
				<div style="float: left; margin-left: 20px;"><asp:Label ID="CourseOfferingLabel" runat="server" /></div>
			</div>
		</asp:Panel>	
		<asp:Panel ID="CourseOfferingPanel1" runat="server" CssClass="collapsePanel" Height="0">
		<data:EntityGridView ID="GridViewCourseOffering1" runat="server"
			AutoGenerateColumns="False"	
			OnSelectedIndexChanged="GridViewCourseOffering1_SelectedIndexChanged"			 			 
			DataSourceID="CourseOfferingDataSource1"
			DataKeyNames="CourseOfferingId"
			AllowMultiColumnSorting="false"
			DefaultSortColumnName="" 
			DefaultSortDirection="Ascending"	
			ExcelExportFileName="Export_CourseOffering.xls"  		
			Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'	
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" />
				<data:HyperLinkField HeaderText="Course Id" DataNavigateUrlFormatString="CourseEdit.aspx?CourseId={0}" DataNavigateUrlFields="CourseId" DataContainer="CourseIdSource" DataTextField="Number" />
				<asp:BoundField DataField="TermStart" HeaderText="Term Start" SortExpression="[TermStart]" />				
				<asp:BoundField DataField="TermEnd" HeaderText="Term End" SortExpression="[TermEnd]" />				
				<asp:BoundField DataField="PassMark" HeaderText="Pass Mark" SortExpression="[PassMark]" />				
				<asp:BoundField DataField="Active" HeaderText="Active" SortExpression="[Active]" />				
				<data:HyperLinkField HeaderText="Coordinator Id" DataNavigateUrlFormatString="InstructorEdit.aspx?InstructorId={0}" DataNavigateUrlFields="InstructorId" DataContainer="CoordinatorIdSource" DataTextField="FirstName" />
			</Columns>
			<EmptyDataTemplate>
				<b>No Course Offering Found! </b>
				<asp:HyperLink runat="server" ID="hypCourseOffering" NavigateUrl="~/admin/CourseOfferingEdit.aspx">Add New</asp:HyperLink>
			</EmptyDataTemplate>
		</data:EntityGridView>					
		
		<data:CourseOfferingDataSource ID="CourseOfferingDataSource1" runat="server" SelectMethod="Find"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:CourseOfferingProperty Name="Instructor"/> 
					<data:CourseOfferingProperty Name="Course"/> 
					<%--<data:CourseOfferingProperty Name="SectionCollection" />--%>
					<%--<data:CourseOfferingProperty Name="EvaluationComponentCollection" />--%>
				</Types>
			</DeepLoadProperties>
			
		    <Parameters>
				<data:SqlParameter Name="Parameters">
					<Filters>
						<data:CourseOfferingFilter  Column="CourseId" QueryStringField="CourseId" /> 
					</Filters>
				</data:SqlParameter>
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" /> 
		    </Parameters>
		</data:CourseOfferingDataSource>		
		
		<br />
		</asp:Panel>
		<asp:Panel ID="CoursePrerequisitePanel2" runat="server" CssClass="collapsePanelHeader"> 
			<div style="padding:5px; cursor: pointer; vertical-align: middle;">
				<div style="float: left; vertical-align: middle;"><asp:Image ID="CoursePrerequisiteImage" runat="server" ImageUrl="~/images/expand_blue.jpg"/></div>
				<div style="float: left; padding-left: 5px;">Course Prerequisite Details</div>
				<div style="float: left; margin-left: 20px;"><asp:Label ID="CoursePrerequisiteLabel" runat="server" /></div>
			</div>
		</asp:Panel>	
		<asp:Panel ID="CoursePrerequisitePanel1" runat="server" CssClass="collapsePanel" Height="0">
		<data:EntityGridView ID="GridViewCoursePrerequisite2" runat="server"
			AutoGenerateColumns="False"	
			OnSelectedIndexChanged="GridViewCoursePrerequisite2_SelectedIndexChanged"			 			 
			DataSourceID="CoursePrerequisiteDataSource2"
			DataKeyNames="Id"
			AllowMultiColumnSorting="false"
			DefaultSortColumnName="" 
			DefaultSortDirection="Ascending"	
			ExcelExportFileName="Export_CoursePrerequisite.xls"  		
			Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'	
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" />
				<data:HyperLinkField HeaderText="Primary Course Id" DataNavigateUrlFormatString="CourseEdit.aspx?CourseId={0}" DataNavigateUrlFields="CourseId" DataContainer="PrimaryCourseIdSource" DataTextField="Number" />
				<data:HyperLinkField HeaderText="Required Course Id" DataNavigateUrlFormatString="CourseEdit.aspx?CourseId={0}" DataNavigateUrlFields="CourseId" DataContainer="RequiredCourseIdSource" DataTextField="Number" />
			</Columns>
			<EmptyDataTemplate>
				<b>No Course Prerequisite Found! </b>
				<asp:HyperLink runat="server" ID="hypCoursePrerequisite" NavigateUrl="~/admin/CoursePrerequisiteEdit.aspx">Add New</asp:HyperLink>
			</EmptyDataTemplate>
		</data:EntityGridView>					
		
		<data:CoursePrerequisiteDataSource ID="CoursePrerequisiteDataSource2" runat="server" SelectMethod="Find"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:CoursePrerequisiteProperty Name="Course"/> 
				</Types>
			</DeepLoadProperties>
			
		    <Parameters>
				<data:SqlParameter Name="Parameters">
					<Filters>
						<data:CoursePrerequisiteFilter  Column="PrimaryCourseId" QueryStringField="CourseId" /> 
					</Filters>
				</data:SqlParameter>
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" /> 
		    </Parameters>
		</data:CoursePrerequisiteDataSource>		
		
		<br />
		</asp:Panel>
<%--
DG-Note: Commented out due to code generation error; code template cannot handle tables with two foreign keys to the same foreign table.
		<asp:Panel ID="CoursePrerequisitePanel2" runat="server" CssClass="collapsePanelHeader"> 
			<div style="padding:5px; cursor: pointer; vertical-align: middle;">
				<div style="float: left; vertical-align: middle;"><asp:Image ID="CoursePrerequisiteImage" runat="server" ImageUrl="~/images/expand_blue.jpg"/></div>
				<div style="float: left; padding-left: 5px;">Course Prerequisite Details</div>
				<div style="float: left; margin-left: 20px;"><asp:Label ID="CoursePrerequisiteLabel" runat="server" /></div>
			</div>
		</asp:Panel>	
		<asp:Panel ID="CoursePrerequisitePanel1" runat="server" CssClass="collapsePanel" Height="0">
		<data:EntityGridView ID="GridViewCoursePrerequisite3" runat="server"
			AutoGenerateColumns="False"	
			OnSelectedIndexChanged="GridViewCoursePrerequisite3_SelectedIndexChanged"			 			 
			DataSourceID="CoursePrerequisiteDataSource3"
			DataKeyNames="Id"
			AllowMultiColumnSorting="false"
			DefaultSortColumnName="" 
			DefaultSortDirection="Ascending"	
			ExcelExportFileName="Export_CoursePrerequisite.xls"  		
			Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'	
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" />
				<data:HyperLinkField HeaderText="Primary Course Id" DataNavigateUrlFormatString="CourseEdit.aspx?CourseId={0}" DataNavigateUrlFields="CourseId" DataContainer="PrimaryCourseIdSource" DataTextField="Number" />
				<data:HyperLinkField HeaderText="Required Course Id" DataNavigateUrlFormatString="CourseEdit.aspx?CourseId={0}" DataNavigateUrlFields="CourseId" DataContainer="RequiredCourseIdSource" DataTextField="Number" />
			</Columns>
			<EmptyDataTemplate>
				<b>No Course Prerequisite Found! </b>
				<asp:HyperLink runat="server" ID="hypCoursePrerequisite" NavigateUrl="~/admin/CoursePrerequisiteEdit.aspx">Add New</asp:HyperLink>
			</EmptyDataTemplate>
		</data:EntityGridView>					
		
		<data:CoursePrerequisiteDataSource ID="CoursePrerequisiteDataSource3" runat="server" SelectMethod="Find"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:CoursePrerequisiteProperty Name="Course"/> 
				</Types>
			</DeepLoadProperties>
			
		    <Parameters>
				<data:SqlParameter Name="Parameters">
					<Filters>
						<data:CoursePrerequisiteFilter  Column="RequiredCourseId" QueryStringField="CourseId" /> 
					</Filters>
				</data:SqlParameter>
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" /> 
		    </Parameters>
		</data:CoursePrerequisiteDataSource>		
		
		<br />
		</asp:Panel>
--%>		
<ajaxToolkit:CollapsiblePanelExtender ID="cpeCourseOffering" runat="Server" TargetControlID="CourseOfferingPanel1"
            ExpandControlID="CourseOfferingPanel2" CollapseControlID="CourseOfferingPanel2" Collapsed="True"
            TextLabelID="CourseOfferingLabel" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"
            ImageControlID="CourseOfferingImage" ExpandedImage="~/images/collapse_blue.jpg" CollapsedImage="~/images/expand_blue.jpg"
            SuppressPostBack="true"/>

<ajaxToolkit:CollapsiblePanelExtender ID="cpeCoursePrerequisite" runat="Server" TargetControlID="CoursePrerequisitePanel1"
            ExpandControlID="CoursePrerequisitePanel2" CollapseControlID="CoursePrerequisitePanel2" Collapsed="True"
            TextLabelID="CoursePrerequisiteLabel" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"
            ImageControlID="CoursePrerequisiteImage" ExpandedImage="~/images/collapse_blue.jpg" CollapsedImage="~/images/expand_blue.jpg"
            SuppressPostBack="true"/>

<%--
DG-Note: Commented out due to code generation error; code template cannot handle tables with two foreign keys to the same foreign table.
<ajaxToolkit:CollapsiblePanelExtender ID="cpeCoursePrerequisite" runat="Server" TargetControlID="CoursePrerequisitePanel1"
            ExpandControlID="CoursePrerequisitePanel2" CollapseControlID="CoursePrerequisitePanel2" Collapsed="True"
            TextLabelID="CoursePrerequisiteLabel" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"
            ImageControlID="CoursePrerequisiteImage" ExpandedImage="~/images/collapse_blue.jpg" CollapsedImage="~/images/expand_blue.jpg"
            SuppressPostBack="true"/>
--%>

</asp:Content>

